package cc.wsyw126.java.nowcoder.jd;

import java.util.Scanner;

/**
 * Created by Administrator on 2017/4/7.
 */
public class Solution1 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()) {
            String s = sc.nextLine();
            int n = Integer.valueOf(s);

            String s1 = sc.nextLine();
            int[] flag = new int[n];
            for (int i = 0; i < n; i++) {
                flag[i] = 0;
            }
            for (int i = 0; i < s1.length(); i++) {
                if (s1.charAt(i) != '#' && s1.charAt(i) != 'X') {
                    int l = s1.charAt(i) - '0';
                    for (int j = 1; j <= l && i+j < n; j++) {
                        flag[i+j] = 1;
                    }
                    for (int j = 1; j <= l && i-j>=0; j++) {
                        flag[i-j] = 1;
                    }
                }
            }

            int count = 0;
            for (int i = 0; i < n; i++) {
                if (flag[i] == 1 && s1.charAt(i) == 'X') {
                    count++;
                }
            }
            System.out.println(count);
        }
    }
}
